diff --git a/components/Party/index.tsx b/components/Party/index.tsx index 6e2cd912..16977190 100644 --- a/components/Party/index.tsx +++ b/components/Party/index.tsx @@ -73,7 +73,11 @@ const Party = (props: Props) => { } else { // Not authenticated if (!props.team.user && accountData.userId === props.team.local_id) { + // Set editable editable = true + + // Also set edit key header + setEditKey(props.team.id, props.team.user) } } } @@ -103,14 +107,6 @@ const Party = (props: Props) => { else updateParty(details) } - function localId() { - const cookie = accountCookie() - const parsed = JSON.parse(cookie as string) - if (parsed && !parsed.token) { - return { local_id: parsed.userId } - } else return {} - } - function formatDetailsObject(details: DetailsObject) { const payload: { [key: string]: any } = {} @@ -205,7 +201,10 @@ const Party = (props: Props) => { appState.party.detailsVisible = false // Store the edit key in local storage - if (team.edit_key) storeEditKey(team.id, team.edit_key) + if (team.edit_key) { + storeEditKey(team.id, team.edit_key) + setEditKey(team.id, team.user) + } // Populate state storeCharacters(team.characters) @@ -289,6 +288,15 @@ const Party = (props: Props) => { } } + // Methods: Unauth validation + function localId() { + const cookie = accountCookie() + const parsed = JSON.parse(cookie as string) + if (parsed && !parsed.token) { + return { local_id: parsed.userId } + } else return {} + } + // Render: JSX components const navigation = (